package com.sky.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sky.domain.BaseEntity;
import lombok.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = true)
@SearchBean(tables = " orders o left join order_detail d on o.id = d.order_id and d.del_flag = '0' ", 
        where = "o.del_flag = '0' and :whereAnd: ",autoMapTo = "o",groupBy = " d.name ",orderBy = " sum(d.number) desc ")
public class SalesTop10ReportVO extends BaseEntity {

    /**
     * 订单详情id
     **/
    @DbField("d.id")
    private Long id;

    //订单号
    @DbField("d.number")
    private Integer number;

    //订单状态 1待付款 2待接单 3已接单 4派送中 5已完成 6已取消 7退款
    @DbField("o.status")
    private Integer status;

    //名称
    @DbField("d.name")
    private String name;

    //订单id
    @DbField("d.order_id")
    private Long orderId;

    //下单时间
    @DbField("o.order_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date orderTime;

    /**
     * 下单总数量
     **/
    @DbField("sum(d.number)")
    private Integer sumNumber;
}
